// ============================================================================
//  gDestroyerDOT.uc ::
// ============================================================================
class gDestroyerDOT extends Actor;


var() float Damage;
var() class<DamageType> DamageType;
var() float Interval;
var() float ObjectiveDamageScaling;

var float NextDamageTime;

simulated event PreBeginPlay()
{
}

event PostBeginPlay()
{
    Super.PostBeginPlay();

    if( Owner != None )
    {
        SetBase(Owner);
        Lifespan = Interval;
        Timer();
    }
    else
        Destroy();
}

event BaseChange()
{
    // Die with pawn
    if( Base == None )
        Destroy();
}

event Timer()
{
    local float Dmg;

    if( Owner != None )
    {
        Dmg = Damage;
        if( GameObjective(Owner) != None )
        {
            Dmg *= ObjectiveDamageScaling;
        }
        Owner.TakeDamage(Dmg, Instigator, Owner.Location, vect(0,0,0), DamageType);
        NextDamageTime = Level.TimeSeconds + Interval;
    }
}

function DelayedDamage( Pawn Killer )
{
    // Don't cross the streams. It would be bad. Total protonic reversal.
    if( Instigator == Killer && NextDamageTime > Level.TimeSeconds )
    {
        Lifespan = Interval + NextDamageTime - Level.TimeSeconds;
        SetTimer( NextDamageTime - Level.TimeSeconds, False );
    }
    else
    {
        Instigator = Killer;
        Lifespan = Interval;
        Timer();
    }
}

defaultproperties
{
     Damage=45.000000
     DamageType=Class'Engine.DamageType'
     Interval=0.500000
     ObjectiveDamageScaling=4.000000
     LightType=LT_Steady
     LightEffect=LE_NonIncidence
     LightHue=30
     LightBrightness=127.000000
     LightRadius=8.000000
     bDynamicLight=True
     RemoteRole=ROLE_None
     AmbientSound=ProceduralSound'TFMedia.acid.acd_p_tss'
     SoundVolume=255
}
